//
//  Constans.h
//  ZLPhotoBrowser
//
//  Created by qinyulun on 16/4/25.
//  Copyright © 2016年 long. All rights reserved.
//

#ifndef Constans_h
#define Constans_h

#define SCREEN_WIDTH_BOUNDS  CGRectGetWidth([UIScreen mainScreen].bounds)
#define SCREEN_HEIGHT_BOUNDS CGRectGetHeight([UIScreen mainScreen].bounds)
#define space 10

#define NavStateBarHight (20)
#define NavBarHight (44)
#define NavBarAndStateBarHight (NavStateBarHight + NavBarHight)


//视图尺寸
#define WIDTH(view) view.frame.size.width
#define HEIGHT(view) view.frame.size.height
#define IMGWIDTH(image) image.size.width
#define IMGHEIGHT(image) image.size.height
#define X(view) view.frame.origin.x
#define Y(view) view.frame.origin.y

#define MaxX(view) CGRectGetMaxX(view.frame)
#define MaxY(view) CGRectGetMaxY(view.frame)

#define MaxScreenX CGRectGetWidth([UIScreen mainScreen].bounds)
#define MaxScreenY CGRectGetHeight([UIScreen mainScreen].bounds)

#define LEFT(view) view.frame.origin.x
#define TOP(view) view.frame.origin.y
#define BOTTOM(view) (view.frame.origin.y + view.frame.size.height)
#define RIGHT(view) (view.frame.origin.x + view.frame.size.width)

//拼接字符串
#define $str(...)   [NSString stringWithFormat:__VA_ARGS__]

#define IOS [[[UIDevice currentDevice] systemVersion] floatValue]

#define IOS7 ( IOS >= 7.0)
#define IOS8 ( IOS >= 8.0)
#define IOS9 ( IOS >= 9.0)
#define IOS4 (IOS < 5.0)


//正常字体
#define kFontHeitiRegular_26 [UIFont fontWithName:@"Heiti SC" size:26]
#define kFontHeitiRegular_32 [UIFont fontWithName:@"Heiti SC" size:32]
#define kFontHeitiRegular_24 [UIFont fontWithName:@"Heiti SC" size:24]
#define kFontHeitiRegular_22 [UIFont fontWithName:@"Heiti SC" size:22]
#define kFontHeitiRegular_20 [UIFont fontWithName:@"Heiti SC" size:20]
#define kFontHeitiRegular_18 [UIFont fontWithName:@"Heiti SC" size:18]
#define kFontHeitiRegular_16 [UIFont fontWithName:@"Heiti SC" size:16]
#define kFontHeitiRegular_15 [UIFont fontWithName:@"Heiti SC" size:15]
#define kFontHeitiRegular_14 [UIFont fontWithName:@"Heiti SC" size:14]
#define kFontHeitiRegular_13 [UIFont fontWithName:@"Heiti SC" size:13]
#define kFontHeitiRegular_12 [UIFont fontWithName:@"Heiti SC" size:12]
#define kFontHeitiRegular_10 [UIFont fontWithName:@"Heiti SC" size:10]
#define kFontHeitiRegular_9  [UIFont fontWithName:@"Heiti SC" size:9]
#define kFontHeitiRegular_8  [UIFont fontWithName:@"Heiti SC" size:8]
#define kFontHeitiRegular_7  [UIFont fontWithName:@"Heiti SC" size:7]
#define kFontHeitiRegular_11 [UIFont fontWithName:@"Heiti SC" size:11]
#define kFontHeitiRegularBold_16 [UIFont fontWithName:@"Heiti SC-Bold" size:16]
#define kFontHeitiRegularBold_6 [UIFont fontWithName:@"Heiti SC-Bold" size:6]

static inline float widthForString(NSString* str,UIFont* font,float height)
{
    CGRect rect = [str boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, height) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:font} context:nil];
    return rect.size.width;
}



#endif /* Constans_h */
